package view.full.event;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;
import javax.swing.Timer;

import event.model.Dsek;
import event.model.Event;

@SuppressWarnings("serial")
public class EventTab extends JPanel implements ActionListener {
	
	private Timer t;
	private Dsek model;
	
	
	public EventTab(Dsek model) {
		this.model = model;
		setLayout(new GridLayout(3, 2, 5, 5));
		updateFrame();
		t = new Timer(1000, this);
		t.start();
	}

	public void updateFrame() {
		removeAll();
		for (Event e : model.getEvents()) {
			add(new EventItem(e));
		}
	}
	
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		updateFrame();
	}
	
	
}
